let querystring = require('querystring') //导入内置对象
let mm = "id=1&name=张三&location=大连"
console.log(querystring.parse(mm)) //解析--结果=> { id: '1', name: '张三', location: '大连' }
// 把格式转化为id=1&name=xx格式的
let cc = {
    id:1,
    name:"张三",
    address:"北京"
}
console.log(querystring.stringify(cc)) //转化为带有&号的
// 转义
let cm = "id=1&name=hehe&url=http:www.baidu.com";
console.log(querystring.escape(cm))//id%3D1%26name%3Dhehe%26url%3Dhttp%3Awww.baidu.com

let str = "id%3D1%26name%3Dhehe%26url%3Dhttp%3Awww.baidu.com"
console.log(querystring.unescape(str))
